package com.lottery.material.service.admin.banner.impl;

import com.lottery.material.dao.banner.BannerJumpTypeDictMapper;
import com.lottery.material.pojo.banner.BannerJumpTypeDict;
import com.lottery.material.service.admin.banner.BannerJumpTypeDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Description：banner跳转类型字典服务接口实现类
 * Created by 朱正磊 on 2019-04-13 14:39
 */
@Service("adminBannerJumpTypeDictService")
public class BannerJumpTypeDictServiceImpl implements BannerJumpTypeDictService {

    private final BannerJumpTypeDictMapper bannerJumpTypeDictMapper;

    @Autowired
    public BannerJumpTypeDictServiceImpl(BannerJumpTypeDictMapper bannerJumpTypeDictMapper) {
        this.bannerJumpTypeDictMapper = bannerJumpTypeDictMapper;
    }

    /**
     * description：新增一条数据
     * user 朱正磊
     * time 2019-04-20 15:14
     * @param bannerJumpTypeDict 对象
     * @return 返回持久化操作数据库状态值
     */
    @Override
    public Integer add(BannerJumpTypeDict bannerJumpTypeDict) {
        return bannerJumpTypeDictMapper.insertSelective(bannerJumpTypeDict);
    }

    /**
     * description：根据主键物理删除
     * user 朱正磊
     * time 2019-04-20 15:13
     * @param id 主键
     * @return 返回持久化操作数据库状态值
     */
    @Override
    public Integer deleteById(Integer id) {
        return bannerJumpTypeDictMapper.deleteByPrimaryKey(id);
    }

    /**
     * description：根据主键查询唯一数据
     * user 朱正磊
     * time 2019-04-20 15:15
     * @param id 主键
     * @return 返回唯一数据
     */
    @Override
    public BannerJumpTypeDict findById(Integer id) {
        return bannerJumpTypeDictMapper.selectByPrimaryKey(id);
    }

    /**
     * description：根据主键修改一条数据
     * user 朱正磊
     * time 2019-04-20 15:16
     * @param bannerJumpTypeDict 对象
     * @return 返回持久化操作数据库状态值
     */
    @Override
    public Integer updateById(BannerJumpTypeDict bannerJumpTypeDict) {
        return bannerJumpTypeDictMapper.updateByPrimaryKeySelective(bannerJumpTypeDict);
    }

    /**
     * description：查询所有的banner跳转类型字典数据
     * user 朱正磊
     * time 2019-05-21 15:30
     * @return 返回banner跳转类型字典数据列表
     */
    @Override
    public List<BannerJumpTypeDict> findAll() {
        return bannerJumpTypeDictMapper.findAll();
    }

}
